Section 7.6.5.2
Tiles

Earlier versions of POV-Ray had a special texture called tiles texture that created a checkered pattern of textures. Although it is still supported for backwards computability you should use a checker block texture pattern described in section "Texture Maps" rather than tiles textures.

Section 7.6.5.3
Material Maps

The material map special texture extends the concept of image maps to apply to entire textures rather than solid colors. A material map allows you to wrap a 2-D bit-mapped texture pattern around your 3-D objects.

Instead of placing a solid color of the image on the shape like an image map, an entire texture is specified based on the index or color of the image at that point. You must specify a list of textures to be used like a texture palette rather than the usual color palette.

When used with mapped file types such as GIF, and some PNG and TGA images, the index of the pixel is used as an index into the list of textures you supply. For unmapped file types such as some PNG and TGA images the 8 bit value of the red component in the range 0-255 is used as an index.

If the index of a pixel is greater than the number of textures in your list then the index is taken modulo N where N is the length of your list of textures.


Section 7.6.5.3.1
Specifying a Material Map

The syntax of a material map is...

texture { material_map { FILE_TYPE "filename" BITMAP_MODIFIERS... texture {...} // First used for index 0 texture {...} // Second texture used for index 1 texture {...} // Third texture used for index 2 texture {...} // Fourth texture used for index 3 // and so on for however many used. } TRANSFORMATION... }

Where FILE_TYPE is one of the following keywords gif, tga, iff, ppm, pgm, png or sys. This is followed by the name of the file using any valid string expression. Several optional modifiers may follow the file specification. The modifiers are described below. Note that earlier versions of POV-Ray allowed some modifiers before the FILE_TYPE but that syntax is being phased out in favor of the syntax described here.

Filenames specified in the material_map statements will be searched for in the home (current) directory first and, if not found, will then be searched for in directories specified by any +L switches or Library_Path options. This would facilitate keeping all your material map files in a separate subdirectory and specifying a library path to them. Note that any operating system default paths are not searched unless you also specify them as a Library_Path.

By default, the material is mapped onto the x-y-plane. The material is projected onto the object as though there were a slide projector somewhere in the -z-direction. The material exactly fills the square area from (x,y) coordinates (0,0) to (1,1) regardless of the bitmap's original size in pixels. If you would like to change this default you may translate, rotate or scale the texture to map it onto the object's surface as desired.

The file name is optionally followed by one or more BITMAP_MODIFIERS. See section "Bitmap Modifiers" for other details.

After a material_map statement but still inside the texture statement you may apply any legal texture modifiers. Note that no other pigment, normal, finish or halo statements may be added to the texture outside the material map. The following is illegal:

texture { material_map { gif "matmap.gif" texture {T1} texture {T2} texture {T3} } finish {phong 1.0} }

The finish must be individually added to each texture.

Note that earlier versions of POV-Ray allowed such specifications but they were ignored. The above restrictions on syntax were necessary for various bug fixes. This means some POV-Ray 1.0 scenes using material maps many need minor modifications that cannot be done automatically with the version compatibility mode.

If particular index values are not used in an image then it may be necessary to supply dummy textures. It may be necessary to use a paint program or other utility to examine the map file's palette to determine how to arrange the texture list.

The textures within a material map texture may be layered but material map textures do not work as part of a layered texture. To use a layered texture inside a material map you must declare it as a texture identifier and invoke it in the texture list.


Section 7.6.6
Layered Textures

It is possible to create a variety of special effects using layered textures. A layered texture consists of several textures that are partially transparent and are laid one on top of the other to create a more complex texture. The different texture layers show through the transparent portions to create the appearance of one texture that is a combination of several textures.

You create layered textures by listing two or more textures one right after the other. The last texture listed will be the top layer, the first one listed will be the bottom layer. All textures in a layered texture other than the bottom layer should have some transparency. For example:

object { My_Object texture {T1} // the bottom layer texture {T2} // a semi-transparent layer texture {T3} // the top semi-transparent layer }

In this example T2 shows only where T3 is transparent and T1 shows only where T2 and T3 are transparent.

The color of underlying layers is filtered by upper layers but the results do not look exactly like a series of transparent surfaces. If you had a stack of surfaces with the textures applied to each, the light would be filtered twice: once on the way in as the lower layers are illuminated by filtered light and once on the way out. Layered textures do not filter the illumination on the way in. Other parts of the lighting calculations work differently as well. The results look great and allow for fantastic looking textures but they are simply different from multiple surfaces. See stones.inc in the standard include files directory for some magnificent layered textures.

Note layered textures must use the texture wrapped around any pigment, normal or finish statements. Do not use multiple pigment, normal or finish statements without putting them inside the texture statement.

Layered textures may be declared. For example

#declare Layered_Examp = texture {T1} texture {T2} texture {T3}

may be invoked as follows:

object { My_Object texture { Layer_Examp // Any pigment, normal or finish here // modifies the bottom layer only. } }

If you wish to use a layered texture in a block pattern, such as checker, hexagon, or brick, or in a material map, you must declare it first and then reference it inside a single texture statement. A special texture cannot be used as a layer in a layered texture however you may use layered textures as any of the textures contained within a special texture.


Section 7.6.7
Patterns

POV-Ray uses a method called three-dimensional solid texturing to define the color, bumpiness and other properties of a surface. You specify the way that the texture varies over a surface by specifying a pattern. Patterns are used in pigments, normals and texture maps.

All patterns in POV-Ray are three dimensional. For every point in space, each pattern has a unique value. Patterns do not wrap around a surface like putting wallpaper on an object. The patterns exist in 3d and the objects are carved from them like carving an object from a solid block of wood or stone.

Consider a block of wood. It contains light and dark bands that are concentric cylinders being the growth rings of the wood. On the end of the block you see these concentric circles. Along its length you see lines that are the veins. However the pattern exists throughout the entire block. If you cut or carve the wood it reveals the pattern inside. Similarly an onion consists of concentric spheres that are visible only when you slice it. Marble stone consists of wavy layers of colored sediments that harden into rock.

These solid patterns can be simulated using mathematical functions. Other random patterns such as granite or bumps and dents can be generated using a random number system and a noise function.

In each case, the x, y, z coordinate of a point on a surface is used to compute some mathematical function that returns a float value. When used with color maps or pigment maps, that value looks up the color of the pigment to be used. In normal statements the pattern function result modifies or perturbs the surface normal vector to give a bumpy appearance. Used with a texture map, the function result determines which combinations of entire textures to be used.

The following sections describe each pattern. See the sections "Pigment" and "Normal" for more details on how to use patterns.


Section 7.6.7.1
Agate

The agate pattern is a banded pattern similar to marble but it uses a specialized built-in turbulence function that is different from the traditional turbulence. The traditional turbulence can be used as well but it is generally not necessary because agate is already very turbulent. You may control the amount of the built-in turbulence by adding the agate_turb keyword followed by a float value. For example: pigment { agate agate_turb 0.5 color_map { ... } }

The agate pattern uses the ramp_wave wave type by default but may use any wave type. The pattern may be used with color_map, pigment_map, normal_map, slope_map and texture_map.


Section 7.6.7.2
Average

Technically average is not a pattern type but it is listed here because the syntax is similar to other patterns. Typically a pattern type specifies how colors or normals are chosen from a pigment map or normal map, however average tells POV-Ray to average together all of the patterns you specify. Average was originally designed to be used in a normal statement with a normal map as a method of specifying more than one normal pattern on the same surface. However average may be used in a pigment statement with a pigment map or in a texture statement with a texture map to average colors too.

When used with pigments, the syntax is:

pigment { average pigment_map { [WEIGHT_1 PIGMENT_BODY_1] [WEIGHT_2 PIGMENT_BODY_2] ... [WEIGHT_n PIGMENT_BODY_n] } PIGMENT_MODIFIER }

Similarly you may use a texture map in a texture statement. All textures are fully computed. The resulting colors are then weighted and averaged.

When used with a normal map in a normal statement, multiple copies of the original surface normal are created and are perturbed by each pattern. The perturbed normals are then weighted, added and normalized.

See the sections "Pigment Maps", "Normal Maps" and "Texture Maps" for more information.


Section 7.6.7.3
Bozo

The bozo pattern is a very smooth, random noise function that is traditionally used with some turbulence to create clouds. The spotted pattern is identical to bozo but in early versions of POV-Ray spotted did not allow turbulence to be added. Turbulence can now be added to any pattern so these are redundant but both are retained for backwards compatibility. The bumps pattern is also identical to bozo when used anywhere except in a normal statement. When used as a normal, bumps uses a slightly different method to perturb the normal with a similar noise function.

The bozo noise function has the following properties:

1.It's defined over 3D space i.e., it takes x, y, and z and returns the noise value there.
2.If two points are far apart, the noise values at those points are relatively random.
3.If two points are close together, the noise values at those points are close to each other.

You can visualize this as having a large room and a thermometer that ranges from 0.0 to 1.0. Each point in the room has a temperature. Points that are far apart have relatively random temperatures. Points that are close together have close temperatures. The temperature changes smoothly but randomly as we move through the room.

Now let's place an object into this room along with an artist. The artist measures the temperature at each point on the object and paints that point a different color depending on the temperature. What do we get? A POV-Ray bozo texture!

The bozo pattern uses the ramp_wave wave type by default but may use any wave type. The pattern may be used with color_map, pigment_map, normal_map, slope_map and texture_map.


Section 7.6.7.4
Brick

The brick pattern generates a pattern of bricks. The bricks are offset by half a brick length on every other row in the x- and z-directions. A layer of mortar surrounds each brick. The syntax is given by

pigment { brick COLOR_1, COLOR_2 brick_size VECTOR mortar FLOAT }

where COLOR_1 is the color of the mortar and COLOR_2 is the color of the brick itself. If no colors are specified a default deep red and dark gray are used. The default size of the brick and mortar together is <8, 3, 4.5> units. The default thickness of the mortar is 0.5 units. These values may be changed using the optional brick_size and mortar pattern modifiers. You may also use pigment statements in place of the colors. For example:

pigment { brick pigment{Jade}, pigment{Black_Marble} }

When used with normals, the syntax is

normal { brick BUMP_FLOAT }

Where BUMP_FLOAT is an optional bump size float value. You may also use full normal statements. For example:

normal { brick normal{bumps 0.2}, normal{granite 0.3} }

When used with textures, the syntax is

texture { brick texture{T_Gold_1A}, texture{Stone12} }

This is a block pattern which cannot use wave types, color map, or slope map modifiers.


Section 7.6.7.5
Bumps

The bumps pattern was originally designed only to be used as a normal pattern. It uses a very smooth, random noise function that creates the look of rolling hills when scaled large or a bumpy orange peal when scaled small. Usually the bumps are about 1 unit apart.

When used as a normal, bumps uses a specialized normal perturbation function. This means that the bumps pattern cannot be used with normal map, slope map or wave type modifiers in a normal statement.

When used as a pigment pattern or texture pattern, the bumps pattern is identical to bozo or spotted and is similar to normal bumps but is not identical as are most normals when compared to pigments. When used as pigment or texture statements the bumps pattern uses the ramp_wave wave type by default but may use any wave type. The pattern may be used with color_map, pigment_map, and texture_map.


Section 7.6.7.6
Checker

The checker pattern produces a checkered pattern consisting of alternating squares of COLOR_1 and COLOR_2. If no colors are specified then default blue and green colors are used.

pigment { checker COLOR_1, COLOR_2 }

The checker pattern is actually a series of cubes that are one unit in size. Imagine a bunch of 1 inch cubes made from two different colors of modeling clay. Now imagine arranging the cubes in an alternating check pattern and stacking them in layer after layer so that the colors still alternate in every direction. Eventually you would have a larger cube. The pattern of checks on each side is what the POV-Ray checker pattern produces when applied to a box object. Finally imagine cutting away at the cube until it is carved into a smooth sphere or any other shape. This is what the checker pattern would look like on an object of any kind.

You may also use pigment statements in place of the colors. For example:

pigment { checker pigment{Jade}, pigment{Black_Marble} }

When used with normals, the syntax is

normal { checker BUMP_FLOAT }

Where BUMP_FLOAT is an optional bump size float value. You may also use full normal statements. For example:

normal { checker normal{gradient x scale .2}, normal{gradient y scale .2} }

When used with textures, the syntax is...

texture { checker texture{T_Wood_3A},texture{Stone12} }

This use of checker as a texture pattern replaces the special tiles texture in previous versions of POV-Ray. You may still use tiles but it may be phased out in future versions so checker textures are best.

This is a block pattern which cannot use wave types, color map, or slope map modifiers.


Next Section
Table Of Contents